from threading import Thread
from time import sleep


class MyThread(Thread):
    def __init__(self, name):
        Thread.__init__(self)
        self.name = name

    def run(self):
        for i in range(3):
            print(f'{self.name}的第{i}次执行')
            sleep(1)


if __name__ == '__main__':
    print('----主线程启动----')
    t1 = MyThread('t1')
    t2 = MyThread('t2')
    t1.start()
    t2.start()
    print('----主线程结束----')
